package com.yixun.qfbao.hander;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.model.dto.CompanyDto;
import com.yixun.qfbao.service.CompanyService;
import com.yixun.qfbao.utils.LoginUtils;
import com.yixun.qfbao.vo.SaveAgentCompanyRegesitReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * @author zilong.liu
 * @date 2020-12-16
 *
 * desc:
 *     	根据用户ID获取对应保存人员审核规则
 */
@Service("saveAgentCompanyRegesitHander")
public class SaveAgentCompanyRegesitHander extends CommonAbstractHander{

	@Autowired
	CompanyService companyService;
	
	@Autowired
	LoginUtils loginUtils;
	
	@Override
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		SaveAgentCompanyRegesitReqVo reqVo = (SaveAgentCompanyRegesitReqVo) reqDto;
		String companyUuid = reqVo.getParams().getCompanyUuid();
		String enableAgentComapnyCheck = reqVo.getParams().getEnableAgentCompanyCheck();
		
		CompanyDto entity = new CompanyDto();
		entity.setCompanyUuid(companyUuid);
		entity.setEnableAgencyRegesit(enableAgentComapnyCheck);
		companyService.updateByComapnyUuid(entity);
//		int result = companyService.update(entity);
		
		BaseResponseDTO res = new BaseResponseDTO();
		res.setResData( "保存成功");
		res.setResult(ResultEnum.SUCCESS.getNo());
		return res;
	}

}
